const path = require("path");
const port = process.env.port || 9528;
function resolve(dir) {
  return path.join(__dirname, dir);
}
console.log(process.env,process.env.por);
module.exports = {
  publicPath: "/",
  assetsDir: "static",
  outputDir: 'dist',
  productionSourceMap: false,
  devServer: {
    port: port,
    host: "localhost",
    open: true,
      overlay: {
      warnings: false,
      errors: true
      },
    proxy: {
      "/v1": {
        // target: process.env.VUE_APP_API_PATH,
        target:'https://www.doane.top',
        changeOrigin: true,
        pathRewrite: {
          "^/v1": ""
        }
      },
    },
    // headers: {
    //   "Access-Control-Allow-Origin": "*",
    // },
    disableHostCheck: true,
    // after: require('./mock/mock-server.js')
  },
  css: {
    loaderOptions: {
      sass: {
        additionalData: `@import "~@/css/include/base.scss";`, //设置默认引用的css类
      },
    },
  },
  chainWebpack(config) {
    config.plugins.delete("preload");
    config.plugins.delete("prefetch");
    // set svg-sprite-loader
    config.module.rule("svg").exclude.add(resolve("src/icons")).end();
    config.module
      .rule("icons")
      .test(/\.svg$/)
      .include.add(resolve("src/icons"))
      .end()
      .use("svg-sprite-loader")
      .loader("svg-sprite-loader")
      .options({
        symbolId: "icon-[name]",
      })
      .end();

    config.when(process.env.NODE_ENV === "development", (config) =>
      config.devtool("cheap-source-map")
    );
  },
};
